package cn.edu.zut.controller;

import cn.edu.zut.domain.ContestRegistry;
import cn.edu.zut.service.ContestRegistryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/contestRegistry")
public class ContestRegistryController {

    @Autowired
    private ContestRegistryService service;

    @RequestMapping("/findAll.do")
    public @ResponseBody List<ContestRegistry> findAll() {
        return service.findAll();
    }

    @RequestMapping("/deleteById.do")
    public @ResponseBody void deleteById(@RequestBody int id) {
        System.out.println(id);
        service.deleteById(id);
    }
    @RequestMapping("/update.do")
    public @ResponseBody void update(@RequestBody ContestRegistry contestRegistry) {
        service.update(contestRegistry);
    }

    @RequestMapping("/findLikeAllByPrint.do")
    public @ResponseBody List<ContestRegistry> findLikeAllByPrint(@RequestBody ContestRegistry contestRegistry) {
        System.out.println(contestRegistry);
        return service.findLikeAllByPrint(contestRegistry);
    }
}
